#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926
#define   SQUARE(x) ((x)*(x))
//double SQUARE(double x) { return x*x;}

int j, y, t;
int main()
{
	int x,n;
	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%d", &x);
		if(1 == x) j++;
		if(5 == x) y++;
		if(10 == x) t++;
	}
	printf("%d\n%d\n%d", j, y, t);
  return 0;
}
